package com.web.type;

import com.bean.Articletype;
import com.service.ArticleTypeService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

public class ListTypeServlet extends HttpServlet {
    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ArticleTypeService service=new ArticleTypeService();

        try {
            List<Articletype> Lt =service.getAllType();
            req.getSession().setAttribute("listType",Lt);
            req.getRequestDispatcher("/admin/articletype/list.jsp").forward(req, resp);
           // System.out.println(Lt);

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
